package com.chukun.rpc.provider;

import com.chukun.rpc.api.IRpcComputeService;

public class RpcComputeServiceImpl implements IRpcComputeService {

    @Override
    public int add(int a, int b) {
        return a + b;
    }

    @Override
    public int sub(int a, int b) {
        return a - b;
    }

    @Override
    public int mult(int a, int b) {
        return a * b;
    }

    @Override
    public int div(int a, int b) {
        if (b == 0) {
            throw new IllegalArgumentException("divisor is must be greater than zero");
        }
        return a / b;
    }
}
